package com.tidc.commonality.api;

import com.tidc.commonality.fallbackFactory.TeacherScoreFallbackFactory;
import com.tidc.commonality.ov.UserOV;
import com.tidc.commonality.pojo.Score;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassNmae TeacherScoreApi
 * @Description TODO
 * @Author 冯涛滔
 **/
@FeignClient(name = "SCOREPROVIDER",fallbackFactory = TeacherScoreFallbackFactory.class)
public interface TeacherScoreApi {
	@ApiOperation("根据当前登录的老师id以及作品id来给作品评分，只需要分数以及比赛的id和作品id 如果返回500则是提醒该老师已经进行过评分了")
	@RequestMapping(value = "/teacher/score",method = RequestMethod.POST)
	public UserOV postScore(@RequestParam("token")String token,@RequestBody Score score);

	@ApiOperation("根据当前登录的老师id以及作品id来查看这个作品老师是否有进行过评分以及评了多少分,需要作品id")
	@RequestMapping(value = "/teacher/score/{id}",method = RequestMethod.GET)
	public UserOV getScore(@RequestParam("token") String token, @PathVariable int id);

	@ApiOperation("修改分数")
	@RequestMapping(value = "/teacher/score",method = RequestMethod.PUT)
	public UserOV setScore(@RequestParam("token")String token, @RequestBody Score score);
}
